﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace UCL.Forms.Components
{
    public partial class frmPathConfirm : Form
    {
        public string FolderPath { get; set; }
        public Action<string> EventHandler { get; set; }
        public frmPathConfirm()
        {
            InitializeComponent();
        }

        private void frmPathConfirm_Load(object sender, EventArgs e)
        {
            tbPath.Text = FolderPath;
        }

        private void btnYes_Click(object sender, EventArgs e)
        {
            if (tbPath.TextLength == 0)
            {
                MessageBox.Show("路径无效");
                return;
            }
            EventHandler(tbPath.Text);
            this.Close();
        }

        private void btnNo_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnBrowser_Click(object sender, EventArgs e)
        {
            if (DialogResult.OK != folderBrowserDialog1.ShowDialog()) return;
            tbPath.Text = folderBrowserDialog1.SelectedPath;
        }
    }
}
